<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
   <style>
       div{
           width: 100px;
           height: 100px;
           /* 方法1：利用border实现 */
           /* border: 20px solid #333;
           border-top-color: aqua;
           border-bottom-color: blueviolet;
           border-left-color: brown; */
           /* 方法2：利用clip-path:polygon() */
           clip-path: polygon(0 0,100px 0, 0 100px);
           background-color: chocolate;
       }
   </style>
</head>
<body>
    <!-- 1、用css实现三角形 -->
    <div></div>
    <script>
        // 2、promise接收的函数中resolve()后的代码是否会执行
        // let p = new Promise((resolve,reject)=>{
        //     console.log(456);
        //     resolve(123)
        //     console.log(abc); // 控制台没有打印该语句
        // })
        // p.then((res)=>{
        //     console.log(res);
        // })
        // 3、原型链的最顶层 null
        // 4、reduce实现map
        let arr = [1,2,3,4,5,6]
        // arr.map((item,index,arr)=>{
        //     console.log(item,index,arr);
        // })
        Array.prototype.myMap = function(fn, thisArg){
            var res = []
            thisArg = thisArg || []
            return this.reduce(function(prev,cur,index,arr){
                return res.push(fn.call(thisArg,cur,index,arr))
            },[])
            return res
        }
        arr.myMap((item,index,arr)=>{
            console.log(item,index,arr);
        })
    </script>
</body>
</html>